<template>
  <div class='advertise'>
    <img v-for="(item, index) in listData" :key="index" :src="item.img" alt="">
  </div>
</template>
<script>
export default {
  props:['imgData'],
  components: {},
  name: "",
  data() {
    return {
      listData:[
        {
          img:require('../../assets/imgs/homepage/advertise/advertise.png')
        },{
          img:require('../../assets/imgs/homepage/advertise/advertise.png')
        }
      ]
    };
  },
  computed:{
    formaltList(){
      return this.imgData||this.listData
    }
  },
  methods: {

      init(){
          _g.apiPost('protalHome/banner.do').then(res=>{
              if(res.status == 0){
                  res.data.forEach(data=>{
                      if(data.adName == "底部导航广告位A"){
                          this.$set(this.listData[0],"img",data.pic)
                      }else if(data.adName == "底部导航广告位B"){
                          this.$set(this.listData[1],"img",data.pic)
                      }
                  })
              }else {
                  _g.toMessage(res)
              }
          })
      }
  },
  created() {
      this.init()
  }
};
</script>
<style lang="scss" scoped>
.advertise {
  display: flex;
  justify-content: space-between;
  padding-bottom: 30px;

  img{
    width: calc(50% - 10px);
    height: 145px
  }
}
</style>